import Vue from 'vue'
import App from './App.vue'
// 引入
import Vuex from 'vuex'
//注册
Vue.use(Vuex);
// 创建仓库
const store = new Vuex.Store({
  strict: true,
  state: {
    name: "小明",
    age: 19,
    count: 100,

  },
  mutations: {
    increment(state, value) {
      // 变更状态
      state.count += value
    }
  },
  actions: {
    asyncSetage(store, data) {
      setTimeout(() => {
        store.commit('increment', data)
      }, 2000)

    }
  }

})

Vue.config.productionTip = false

new Vue({
  //挂载
  store,
  render: h => h(App),
}).$mount('#app')
